package com.example.ShoppingManagementSystem.service;

import jakarta.annotation.PostConstruct;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AdminServiceFactory {
    @Getter
    private static  AdminServicempl adminService;

    @PostConstruct
    public void init() {
        if (adminService == null) {
            throw new IllegalStateException("AdminService is not injected!");
        }
    }

    @Autowired
    public void setAdminService(AdminServicempl adminService) {
        AdminServiceFactory.adminService = adminService;
    }
}